package com.hod.client.frontend.utils;

import com.googlecode.gchart.client.GChart;
import com.googlecode.gchart.client.GChart.Curve;


public class Grafico extends GChart {
	Grafico() {
		     setChartTitle("<b>Profile</b>");
		     setChartSize(600, 600);
		     
		     addCurve(); //dato
		     addCurve(); //+3dev
		     addCurve(); //-3dev

		     setCurve(getCurve(0));
		     setCurve(getCurve(1));
		     setCurve(getCurve(2));
		     	     	     
		     getYAxis().setTickLabelFormat("#");
		     getXAxis().setTickLabelFormat("#.####");
		     getXAxis().setHasGridlines(true);
		     getYAxis().setHasGridlines(true);
		     getYAxis().setAxisLabel("pr");
		     for (int i=0;i<=-5000;i-=250)	    	 
		    	 getYAxis().addTick(i);  
		     //for (int i=0;i<=40;i+=5)	    	 
		     //	 getYAxis().addTick(i); 
		  }
		  
		  /**
		   * Constructor para el caso de prop-pro
		   * @param prop
		   */
		  Grafico(boolean prop) {
			     setChartTitle("<b>Prop-Prop</b>");
			     setChartSize(600, 600);
			     
			     addCurve(); //dato

			     setCurve(getCurve(0));
			     	     	     
			     getYAxis().setTickLabelFormat("#.####");
			     getXAxis().setTickLabelFormat("#.####");
			     getXAxis().setHasGridlines(true);
			     getYAxis().setHasGridlines(true);

			  }
		  private void setCurve(Curve curve) {		    
			     curve.getSymbol().setSymbolType(SymbolType.LINE);
			     curve.getSymbol().setFillThickness(2);
			     curve.getSymbol().setFillSpacing(1);
			// Make center-fill of square point markers same color as line:
			     curve.getSymbol().setBackgroundColor(
			     curve.getSymbol().getBorderColor());	    		
		}	  
		public void setData(){		  
			  getCurve().clearPoints();
			  for (int i = 0; i < 10; i++) 
			       getCurve().addPoint(i,i*i);		  
		  }
		}

